package io.github.javpower.imagerex.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.github.javpower.vectorex.keynote.model.MetricType;
import io.github.javpower.vectorexcore.annotation.VectoRexCollection;
import io.github.javpower.vectorexcore.annotation.VectoRexField;
import io.github.javpower.vectorexcore.entity.DataType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
import java.util.List;

@Data
@VectoRexCollection(name = "image")
@AllArgsConstructor
@NoArgsConstructor
public class Image {
    @VectoRexField(
            isPrimaryKey = true
    )
    private String name;//图片名称

    @VectoRexField
    private String image;//图片 base64

    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8")
    @VectoRexField
    private LocalDateTime uploadDate; // 上传日期

    @JsonIgnore
    @VectoRexField(
            name = "vector", // 字段名称
            dataType = DataType.FloatVector,
            dimension = 2048,// 向量维度
            metricType = MetricType.FLOAT_COSINE_DISTANCE
    )
    private List<Float> vector; //调用FeatureExtractor内方法转成的数据

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public LocalDateTime getUploadDate() {
        return uploadDate;
    }

    public void setUploadDate(LocalDateTime uploadDate) {
        this.uploadDate = uploadDate;
    }

    public List<Float> getVector() {
        return vector;
    }

    public void setVector(List<Float> vector) {
        this.vector = vector;
    }
}